﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.InfoConfig.Controller;
using MINERP.MODEL.InfoConfig;
using MINERP.BLL.InfoConfig;


namespace MINERP.InfoConfig
{
    public partial class FrmChangePrice : Form
    {
        
        public FrmChangePrice()
        {
            InitializeComponent();
        }
        public bool IsAddPrice { get; set; }
        public string ChangePriceName { get; set; }
        public ProductEntity product { get; set; }

        private void FrmChangePrice_Load(object sender, EventArgs e)
        {
            groupBox1.Text = "请输入" + ChangePriceName + "金额";
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtUnitPrice.Text == string.Empty)
            {
                txtUnitPrice.Focus();
                MessageBox.Show("请输入单价", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (txtAddPrice.Text == string.Empty)
            {
                txtAddPrice.Focus();
                MessageBox.Show("请输入加页价", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            ProductBLL _bll = new ProductBLL();
            try
            {
                _bll.ChangePrice(product, Convert.ToDouble(txtAddPrice.Text), Convert.ToDouble(txtUnitPrice.Text), IsAddPrice);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally { this.Close(); }


        }
    }
}
